<?php
	require_once("../../include/connect.php");
	require_once("../../include/datetime.php");
	
	$hoten = ucfirst(addslashes($_POST['hoten']));
	$ngaysinh = date("Y-m-d",strtotime($_POST['ngaysinh']));
	$gioitinh = ucfirst(addslashes($_POST['gioitinh']));
	$dienthoai = addslashes($_POST['dienthoai']);
	$diachi = ucfirst(addslashes($_POST['diachi']));
	$tinh = ucfirst(addslashes($_POST['tinh']));
	$tentruong = ucfirst(addslashes($_POST['tentruong']));
	$khoi = addslashes($_POST['khoi']); $khoi = substr($khoi,2);
	$date = day_now();
	
	if($hoten == "" || $ngaysinh == "" || $gioitinh == "" || $dienthoai == "" || $diachi == "" || $tinh == "" || $tentruong == "" || $khoi=="")
		echo "0";
	else
	{
		$query = mysql_query(" INSERT INTO register(name,birthday,sex,phone,address,province_id,school,chang,date)
				VALUES(N'$hoten', '$ngaysinh', '$gioitinh', '$dienthoai', N'$diachi', '$tinh', N'$tentruong', '$khoi', '$date') ");
		if($query)
			echo "1";
		else
			echo "2";
			//echo $hoten."-".$ngaysinh."-".$gioitinh."-".$dienthoai."-".$diachi."-".$tinh."-".$tentruong."-".$khoi;
	}
?>